package com.fa4j.system.settings.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fa4j.common.base.model.CommonState;
import com.fa4j.common.base.model.Tree;
import com.fa4j.common.data.model.Base;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * 系统字典
 *
 * @since 2025-06-12 16:58:22
 */
@Data
@TableName(value = "t_sys_dict", autoResultMap = true)
@Schema(description = "系统字典")
public class Dict extends Base implements Tree<Integer, Dict> {

    @Schema(description = "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Schema(description = "字典名称")
    private String dictName;

    @Schema(description = "字典编码")
    private String dictCode;

    @Schema(description = "字典值")
    private String dictValue;

    @Schema(description = "值类型")
    private DictValueType valueType;

    @Schema(description = "状态")
    private CommonState state;

    @Schema(description = "上级ID")
    private Integer parentId;

    @Schema(description = "根ID")
    private Integer rootId;

    @Schema(description = "优先级")
    private Integer priority;

    @Schema(description = "当前层级")
    private Integer level;

    @Schema(description = "最大层级")
    private Integer maxLevel;

    @Schema(description = "是否叶子节点")
    private Boolean isLeaf;

    @Schema(description = "操作人ID")
    private Long operatorId;

    @Schema(description = "下级资源")
    @TableField(exist = false)
    private List<Dict> children;

    @Schema(description = "自定义字段")
    @TableField(exist = false)
    private List<DictCustomField> customFields;

    @Schema(description = "自定义值")
    @TableField(exist = false)
    private Map<String, Object> customData;

}
